package com.dmooo.yxmmerchant.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;
import com.dmooo.yxmmerchant.R;
import com.dmooo.yxmmerchant.view.model.AccPass;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.List;

public class AccountAdapter extends CommonAdapter<AccPass> {


    private OnDeleteClickLister mDeleteClickListener;

    public AccountAdapter(Context context, int layoutId, List<AccPass> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, AccPass accPasses, int position) {
        TextView title = holder.getView(R.id.txt_account);
        title.setText(accPasses.getMername());

        holder.getView(R.id.tv_delete).setTag(position);
        holder.getView(R.id.tv_delete).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mDeleteClickListener != null) {
                    mDeleteClickListener.onDeleteClick(v, position);
                }
            }
        });

    }

    public void setOnDeleteClickListener(OnDeleteClickLister listener) {
        this.mDeleteClickListener = listener;
    }

    public interface OnDeleteClickLister {
        void onDeleteClick(View view, int position);
    }
}
